package com.eric.domain.po;

import com.mybatisflex.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@Table("tb_book")
public class Book implements Serializable {
    @Id(keyType = KeyType.Auto)
    private Long id;

    private Integer AccountId;

    private String title;

    private String content;

    private Integer version;

    @Column(isLogicDelete = true,onInsertValue = "0")
    private Integer isDeleted;

    @Column(value="create_time",onInsertValue = "now()")
    private Date createTime;

    @Column(value = "update_time",onInsertValue = "now()", onUpdateValue = "now()")
    private Date updateTime;


//    book对应的account是多对一关系
//    总体思路就是，一个account中有多个book，通过其中一个book对象，又查询到对应的account，然后再返回来
//    查询这个account对应的多个book对象
    @RelationManyToOne(selfField = "accountId",targetField = "id")
    private Account account;


}
